﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MINERP.NEWPhotoRindGrid
{
    public partial class FrmSelShop : Form
    {
        public List<string> ListShop { get; set; }//商户列表

        public string SelectedShopName { get; set; }//选择的商户名

        public FrmSelShop()
        {
            InitializeComponent();
        }

        private void FrmSelShop_Load(object sender, EventArgs e)
        {
            //comboBox1.DataSource = ListShop.OrderBy(sp => sp).ToList();
            ListShop = ListShop.OrderBy(s=>s).Distinct().ToList();
            comboBox1.DataSource = ListShop;
        }

        private void comboBox1_SelectionChangeCommitted(object sender, EventArgs e)
        {
            SelectedShopName = comboBox1.Text;
            if (!string.IsNullOrEmpty(SelectedShopName))
            {
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                MessageBox.Show("请正确操作！");
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            SelectedShopName = comboBox1.Text.Trim();
            if (!string.IsNullOrEmpty(SelectedShopName))
            {
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                MessageBox.Show("请正确操作！");
            }
            
        }
    }
}
